home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / vol15n11.zip / REXBOX.ZIP / PLAY.CMD < prev    next >
OS/2 REXX Batch file  |  1996-01-30  |  3KB  |  107 lines

  1. /* MCI REXX Sample #4 */
  2. /* this script shows you how to control the volume of a CD and also   */
  3. /* how to pause and resume playback.                                  */
  4.  
  5. signal on error /* When commands fail, call "error" routine. */
  6.  
  7.   call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  8.   call SysLoadFuncs
  9.  
  10.  
  11. rc = RXFUNCADD('mciRxInit','MCIAPI','mciRxInit')
  12. InitRC = mciRxInit()
  13.  
  14. /* Open the CD */
  15.  
  16. rc = mciRxSendString("open cdaudio alias supercd wait", 'Retst', '0', '0')
  17. rc = mciRxSendString("status supercd media present wait", 'Retst', '0', '0')
  18. If Retst <> 'TRUE' then
  19.      do
  20.      say 'Must have CD inserted to run this command file'
  21.      say 'Please insert'
  22.      rc = mciRxSendString("status supercd media present wait", 'Retst', '0', '0')
  23.  
  24.        do while Retst <> 'TRUE'
  25.          rc = mciRxSendString("status supercd media present wait", 'Retst', '0', '0')
  26.        End
  27.      End
  28. rc = mciRxSendString("play supercd", 'Retst', '0', '0')
  29.  
  30. say 'Press I to increase volume:'
  31. say 'Press D to decrease volume:'
  32. say 'Press P to pause playback'
  33. say 'Press R to resume playback'
  34.  
  35. say 'Press Q to quit'
  36. volume=100
  37. volumestring = 'set supercd audio volume '
  38.  
  39. quit = FALSE
  40.  
  41. do while quit <> 'TRUE'
  42.    keyin = SysGetKey('NOECHO')
  43.    SELECT
  44.       WHEN keyin = 'd' | keyin = 'D'
  45.         THEN
  46.           do
  47.            volume = volume - 1
  48.            IF volume <= 0 THEN
  49.              volume = 0
  50.            volumecommand =  volumestring volume ' wait'
  51.            rc = mciRxSendString(volumecommand, 'Retst', '0', '0')
  52.           END
  53.  
  54.       WHEN keyin = 'i' | keyin = 'I'
  55.         THEN
  56.           do
  57.            volume = volume + 1
  58.            IF volume > 100 THEN
  59.              volume = 100
  60.            volumecommand =  volumestring volume ' wait'
  61.            rc = mciRxSendString(volumecommand, 'Retst', '0', '0')
  62.           END
  63.  
  64.       WHEN keyin = 'p' | keyin = 'P'
  65.         THEN
  66.           rc = mciRxSendString("pause supercd wait", 'Retst', '0', '0')
  67.  
  68.  
  69.       WHEN keyin = 'r' | keyin = 'R'
  70.         THEN
  71.           rc = mciRxSendString("resume supercd wait", 'Retst', '0', '0')
  72.       WHEN keyin = 'q' | keyin = 'Q'
  73.         THEN
  74.          quit = TRUE
  75.    OTHERWISE
  76.      SAY "Sorry, but " keyin " isn't supported"
  77.  
  78.    END  /* End select */
  79.  
  80. End
  81.  
  82.  
  83. rc = mciRxSendString("close supercd wait", 'Retst', '0', '0')
  84.  
  85. say 'Finished SuperCD playback sample'
  86. exit
  87.  
  88. error:
  89.    say 'Error' ErrRC 'at line' sigl ', sourceline:' sourceline(sigl)
  90.    say 'Terminating'
  91.    mciRxSendString("close supercd wait", 'Retst', '0', '0')
  92.    mciRxExit()               /* Tell the DLL we're going away */
  93.    exit ErrRC                /* exit, tell caller things went poorly */
  94.  
  95. halt:
  96. /*
  97.  * Close all device alias's, in case we previously killed
  98.  * this batch file in the same process.
  99.  */
  100.    say 'Terminating'
  101.   mciRxSendString("close supercd wait", 'Retst', '0', '0')
  102. exit
  103.  
  104.  
  105.  
  106.  
  107.